package cn.fl.project.controller;

import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.project.condition.PrjCstAccInfoQueryCondition;
import cn.fl.project.constant.PrjBscInfoConstant;
import cn.fl.project.constant.PrjCstAccInfoConstant;
import cn.fl.project.service.IPrjCstAccInfoService;
import cn.fl.project.vo.PrjCstAccInfoVO;
import cn.fl.system.constant.SysLogConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.constant.facade.framework.constant.SysInsInterfaceConstant;
import fl.inf.facade.api.ITransLogApi;
import fl.inf.facade.condition.InfTransLogQueryCondition;
import fl.inf.facade.dto.InfTransLogDTO;
import net.sf.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Description: 项目客户账户信息表 控制层
 */
@Controller
@RequestMapping("/project/prjCstAccInfo")
public class PrjCstAccInfoController extends BaseController {
	private static final Logger logger = LoggerFactory.getLogger(PrjCstAccInfoController.class);
	
	/**
	 * PrjCstAccInfo 服务层BEAN
	 */
	@Autowired
	private IPrjCstAccInfoService prjCstAccInfoService;
	@Autowired
	private ITransLogApi transLogApi;
	
	
	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toListPage", "加载PrjCstAccInfo列表页面.",CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("project/prjcstaccinfo/prjCstAccInfoList");
        this.prepare(request,mav);
		return mav;
	}
	
	/**
	 * 到新增页面
	 */
	@RequestMapping(value = "/toAddPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toAddPage", "加载PrjCstAccInfo Add页面.",CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("project/prjcstaccinfo/prjCstAccInfoModify");
		//this.prepare(request,mav);
		return mav;
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toModifyPage", "加载PrjCstAccInfo Modify页面.",CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("project/prjcstaccinfo/prjCstAccInfoModify");
		this.prepare(request,mav);
		
		String id=request.getParameter("id");
		PrjCstAccInfoVO prjCstAccInfoVO = this.prjCstAccInfoService.selectById(Long.valueOf(id));
        mav.addObject("prjCstAccInfoVO", prjCstAccInfoVO);
		return mav;
	}
	
	//加载数据字典数据、传值等 ？
    public void prepare(HttpServletRequest request,ModelAndView mav){
        List<KeyValueVO> chkRstCdList = this.prjCstAccInfoService.searchCdList(PrjCstAccInfoConstant.CODE_PRJ_CST_CHK_RST_CD);
        mav.addObject("chkRstCdList", JSON.toJSONString(chkRstCdList));
        List<KeyValueVO> cstCertTypCdList = this.prjCstAccInfoService.searchCdList(PrjCstAccInfoConstant.CODE_PRJ_CST_CERT_TYP_CD);
        mav.addObject("certTypCdList", JSON.toJSONString(cstCertTypCdList));
        //查询银行列表
        List<KeyValueVO> bankList = this.prjCstAccInfoService.searchCdList(PrjCstAccInfoConstant.CODE_CZB_SUPPORT_BANK_CD);
        mav.addObject("bankList",JSON.toJSONString(bankList));
    }

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initPrjCstAccInfoList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjCstAccInfoQueryCondition qc = new PrjCstAccInfoQueryCondition();
		String prjId = request.getParameter("prjId");
		String cstNm = request.getParameter("cstNm");
		String chkRstCd = request.getParameter("chkRstCd");
		if (StringUtils.isNotEmpty(prjId)) {
			qc.setPrjId(Long.valueOf(prjId));
		}
		if(StringUtils.isNotBlank(cstNm)){
		    qc.setCstNm(cstNm);
        }
        if(StringUtils.isNotBlank(chkRstCd)){
		    qc.setChkRstCd(chkRstCd);
        }
		page.setCondition(qc);

		BaseLogUtils.info(logger, "initPrjCstAccInfoList", "初始化PrjCstAccInfo列表页面数据.DATA:"+JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		Pager pager = this.prjCstAccInfoService.searchListPage(page);
		List<PrjCstAccInfoVO> list = (List<PrjCstAccInfoVO>) pager.getResultList();
		ListPageVO<PrjCstAccInfoVO> listPage = new ListPageVO<PrjCstAccInfoVO>(list, pager.getTotalCount());
		return listPage;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removePrjCstAccInfoByIds(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String ids = request.getParameter("ids");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        if (StringUtils.isEmpty(ids)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.info(logger, "removePrjCstAccInfoByIds", "删除PrjCstAccInfo数据,主键参数为空!", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        List<Long> idsList = new ArrayList<Long>();
        JSONArray idsArray = JSONArray.fromObject(ids);
        for (Object object : idsArray) {
            idsList.add(Long.valueOf(object.toString()));
        }
		
		try {
			boolean success = this.prjCstAccInfoService.removeByIds(idsList);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
				BaseLogUtils.info(logger, "removePrjCstAccInfoByIds", "删除PrjCstAccInfo数据失败,ID:"+idsList.toString(), CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "removePrjCstAccInfoByIds", "删除PrjCstAccInfo数据成功,ID:"+idsList.toString(), CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "removePrjCstAccInfoByIds", "删除PrjCstAccInfo数据失败,ID:"+idsList.toString()+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removePrjCstAccInfoByIds", "删除PrjCstAccInfo数据失败,系统错误.ID:"+idsList.toString()+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 得到一条记录
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getPrjCstAccInfoById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "getPrjCstAccInfoById", "获取PrjCstAccInfo数据,主键参数为空.", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			PrjCstAccInfoVO vo = this.prjCstAccInfoService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getPrjCstAccInfoById", "获取PrjCstAccInfo数据不存在,ID:"+id, CurrentThreadContext.getCurrentUserName());
			}
			result.setData(vo);
			BaseLogUtils.info(logger, "getPrjCstAccInfoById", "获取PrjCstAccInfo数据成功,ID:"+id, CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "getPrjCstAccInfoById", "获取PrjCstAccInfo数据失败,ID:"+id+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getPrjCstAccInfoById", "获取PrjCstAccInfo数据失败,系统错误.ID:"+id+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 新增
	 *//*
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addPrjCstAccInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjCstAccInfoVO entity = null;//获取参数
		try {
			entity = this.getRequestParamForPrjCstAccInfo(request);//获取参数
			Long id = this.prjCstAccInfoService.add(entity);
			result.setData(id);
			BaseLogUtils.info(logger, "addPrjCstAccInfo", "新增PrjCstAccInfo数据成功,ID:"+id+".DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "addPrjCstAccInfo", "新增PrjCstAccInfo数据失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "addPrjCstAccInfo", "新增PrjCstAccInfo数据失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}*/

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyPrjCstAccInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_UPDATE_SUCC);
		PrjCstAccInfoVO entity = null;
		try {
			entity = this.getRequestParamForPrjCstAccInfo(request);
			if(entity.getId()==null){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
				BaseLogUtils.info(logger, "modifyPrjCstAccInfo", "修改PrjCstAccInfo信息,主键参数为空！.", CurrentThreadContext.getCurrentUserName());
				return result;
			}

			boolean success = this.prjCstAccInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
				BaseLogUtils.info(logger, "modifyPrjCstAccInfo", "修改PrjCstAccInfo数据失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
				return result;
			}
			BaseLogUtils.info(logger, "modifyPrjCstAccInfo", "修改PrjCstAccInfo数据成功.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "modifyPrjCstAccInfo", "修改PrjCstAccInfo数据失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "modifyPrjCstAccInfo", "修改PrjCstAccInfo数据失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 获取请求参数
	 * @param request 请求
	 * @return 
	 */
	private PrjCstAccInfoVO getRequestParamForPrjCstAccInfo(HttpServletRequest request) throws BaseException{
		//获取参数
		String id = request.getParameter("id");//主键
		String cstNm = request.getParameter("cstNm");//客户名称
		String mp = request.getParameter("mp");//客户手机号
		String certNo = request.getParameter("certNo");//证件号码
		String accNo = request.getParameter("accNo");//银行账号
		String certTypCd = request.getParameter("certTypCd");//证件类型（CST0005）
		String bkCd = request.getParameter("bkCd");//银行代码（CST0014）
		String bkNm = request.getParameter("bkNm");//开户银行名称
		String accNm = request.getParameter("accNm");//开户机构
		String bkNo = request.getParameter("bkNo");//开户行号
		String chkRstCd = request.getParameter("chkRstCd");//校验结果 1.校验通过 2.校验不通过3.校验失败

		//验证参数并赋值
		PrjCstAccInfoVO entity = new PrjCstAccInfoVO();
 		entity.setCstNm(cstNm);//客户名称
 		entity.setMp(mp);//客户手机号
 		entity.setCertNo(certNo);//证件号码
 		entity.setAccNo(accNo);//银行账号
 		entity.setCertTypCd(certTypCd);//证件类型（CST0005）
 		entity.setBkCd(bkCd);//银行代码（CST0014）
 		entity.setBkNm(bkNm);//开户银行名称
 		entity.setAccNm(accNm);//开户机构
 		entity.setBkNo(bkNo);//开户行号
 		entity.setChkRstCd(chkRstCd);//校验结果 1.校验通过 2.校验不通过3.校验失败
	
		Date tm=new Date();
		if (StringUtils.isNotBlank(id)) {
			entity.setId(Long.valueOf(id));
			entity.setMdfTm(tm);
			entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
		}else{
			entity.setCrtTm(tm);
			entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		}
		
		return entity;
	}

	/**
	 * 根据项目ID查询客户信息校验是否通过
	 */
	@RequestMapping(value = "/searchAccInfoByPrjId.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object searchAccInfoByPrjId(HttpServletRequest request, HttpServletResponse response) {
		String prjId = request.getParameter("prjId");
		BaseLogUtils.info(logger, "initPrjCstAccInfoList", "根据项目ID查询客户四要素是否校验通过==" + prjId, CurrentThreadContext.getCurrentUserName());
		if (StringUtils.isEmpty(prjId)) {
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "项目id为空");
		}
		PrjCstAccInfoQueryCondition condition = new PrjCstAccInfoQueryCondition();
		condition.setPrjId(Long.valueOf(prjId));
		condition.setChkRstCd(String.valueOf(BaseConstant.IS_YESNO_YES));
        condition.setInsCode(PrjBscInfoConstant.PRJ_INS_CODE_ZS);
		List<PrjCstAccInfoVO> list = this.prjCstAccInfoService.searchList(condition);
		if (CollectionUtils.isNotEmpty(list)) {
			BaseLogUtils.info(logger, "initPrjCstAccInfoList", "根据项目ID查询客户四要素校验通过==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_YES, "客户四要素验证通过");
		} else {
			BaseLogUtils.info(logger, "initPrjCstAccInfoList", "根据项目ID查询客户四要素校验不通过==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "客户四要素(银行卡信息或手机号)校验不通过，请修改后再发起流程");
		}
	}

    /**
     * 根据ID校验客户账户信息
     */
    @RequestMapping(value = "/valide.do", method = { RequestMethod.GET})
    @ResponseBody
    public Object validePrjCstAccInfo(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        BaseLogUtils.info(logger, "initPrjCstAccInfoList", "根据ID校验客户账户信息==" + id, CurrentThreadContext.getCurrentUserName());
        if (StringUtils.isEmpty(id)) {
            return new DataResultVO(BaseConstant.IS_YESNO_NO, "id为空");
        }
        PrjCstAccInfoQueryCondition condition = new PrjCstAccInfoQueryCondition();
        condition.setId(Long.valueOf(id));
        DataResultVO resultVO = this.prjCstAccInfoService.validePrjCstAccInfo(condition);
        BaseLogUtils.info(logger, "initPrjCstAccInfoList", "根据ID校验客户账户信息==" + id+","+JSON.toJSONString(resultVO), CurrentThreadContext.getCurrentUserName());
        return resultVO;
    }
	/**
	 *  //校验浦发开户状态
	 */
	@RequestMapping(value = "/checkInsAcc.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object checkInsAcc(HttpServletRequest request, HttpServletResponse response) {
		String prjId = request.getParameter("prjId");
		BaseLogUtils.info(logger, "checkInsAcc", "根据项目ID查询客户四要素是否校验通过==" + prjId, CurrentThreadContext.getCurrentUserName());
		if (StringUtils.isEmpty(prjId)) {
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "项目id为空");
		}
		//PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		PrjCstAccInfoQueryCondition condition = new PrjCstAccInfoQueryCondition();
		condition.setPrjId(Long.valueOf(prjId));
        condition.setInsCode(PrjBscInfoConstant.PRJ_INS_CODE_SPD);
		List<PrjCstAccInfoVO> list = this.prjCstAccInfoService.searchList(condition);
		PrjCstAccInfoVO prjCstAccInfoVO = null;
		if (CollectionUtils.isNotEmpty(list)) {
			prjCstAccInfoVO = list.get(0);
			/// BaseLogUtils.info(logger, "checkInsAcc", "浦发开户状态验证通过==" + prjId, CurrentThreadContext.getCurrentUserName());
			//return new DataResultVO(BaseConstant.IS_YESNO_YES, "浦发开户状态验证通过");
		}else{
			BaseLogUtils.info(logger, "checkInsAcc", "请先进行开户，开户成功后再发起流程==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "请先进行开户，开户成功后再发起流程");
		}
		InfTransLogQueryCondition infTransLogQueryCondition = new InfTransLogQueryCondition();
		infTransLogQueryCondition.setPrjId(Long.valueOf(prjId));
		infTransLogQueryCondition.setCstId(prjCstAccInfoVO.getCstId());
		//infTransLogQueryCondition.setFundRasInsId(prjCstAccInfoVO.getFundRasInsId());
		infTransLogQueryCondition.setAction(SysInsInterfaceConstant.InsTypeIntfConstant.SPDBANK_TYPE_QUERY_ACCOUNT);
		List<InfTransLogDTO> infTransLogDTOList = transLogApi.findTransLogs(infTransLogQueryCondition);
		InfTransLogDTO infTransLogDTO = null;
		if (CollectionUtils.isNotEmpty(infTransLogDTOList)) {
			infTransLogDTO = infTransLogDTOList.get(0);
		}else{
			BaseLogUtils.info(logger, "checkInsAcc", "请先进行开户，开户成功后再发起流程==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "请先进行开户，开户成功后再发起流程");
		}
		if ("0000".equals(infTransLogDTO.getRespCode())) {
			BaseLogUtils.info(logger, "checkInsAcc", "浦发开户状态验证通过==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_YES, "浦发开户状态验证通过");
		}else if("1000".equals(infTransLogDTO.getRespCode())){
			BaseLogUtils.info(logger, "checkInsAcc", "请待资方返回开户成功后再发起流程" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "请待资方返回开户成功后再发起流程!");
		}else if("0002".equals(infTransLogDTO.getRespCode())){
			BaseLogUtils.info(logger, "checkInsAcc", "根据项目ID查询客户开户不成功==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "浦发开户失败，无法发起流程，请返回修改银行卡信息再次进行短信验证!");
		}else if("0001".equals(infTransLogDTO.getRespCode())){
			BaseLogUtils.info(logger, "checkInsAcc", "根据项目ID查询客户开户不成功==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "浦发开户失败，无法发起流程，请返回修改银行卡信息再次进行短信验证!");
		}else if("0003".equals(infTransLogDTO.getRespCode())){
			BaseLogUtils.info(logger, "checkInsAcc", "异步交易业务异常==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "浦发开户失败，无法发起流程，请返回修改银行卡信息再次进行短信验证!");
		}else{
			BaseLogUtils.info(logger, "checkInsAcc", "未知错误，请开户成功后再发起流程==" + prjId, CurrentThreadContext.getCurrentUserName());
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "浦发开户失败，无法发起流程，请返回修改银行卡信息再次进行短信验证!");
		}
	}
    /**
	 * 根据客户ID查询客户信息校验是否通过
	 */
	@RequestMapping(value = "/getPrjCstAccInfo.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getPrjCstAccInfo(HttpServletRequest request, HttpServletResponse response) {
		String cstId = request.getParameter("cstId");
		BaseLogUtils.info(logger, "getPrjCstAccInfo", "根据客户ID查询客户四要素是否校验通过==" + cstId, CurrentThreadContext.getCurrentUserName());
		if (StringUtils.isEmpty(cstId)) {
			return new DataResultVO(BaseConstant.IS_YESNO_NO, "客户id为空");
		}
		DataResultVO dataResult  = new DataResultVO(BaseConstant.IS_YESNO_NO);
		PrjCstAccInfoQueryCondition condition = new PrjCstAccInfoQueryCondition();
		condition.setCstId(Long.valueOf(cstId));
		condition.setChkRstCd(String.valueOf(BaseConstant.IS_YESNO_YES));
		condition.setIsDel(0);
        condition.setInsCode(PrjBscInfoConstant.PRJ_INS_CODE_ZS);
		List<PrjCstAccInfoVO> prjCstAccInfoList = this.prjCstAccInfoService.searchList(condition);
		if (CollectionUtils.isNotEmpty(prjCstAccInfoList)) {
			BaseLogUtils.info(logger, "getPrjCstAccInfoByCstId", "根据客户ID查询客户四要素校验通过==" + cstId, CurrentThreadContext.getCurrentUserName());
			dataResult.setData(prjCstAccInfoList.get(0));
			dataResult.setSuccess(BaseConstant.IS_YESNO_YES);
		} else {
			BaseLogUtils.info(logger, "getPrjCstAccInfoByCstId", "根据客户ID查询客户四要素校验不通过==" + cstId, CurrentThreadContext.getCurrentUserName());
		}
		return dataResult ;
	}
}

